package com.study.config;

import com.study.interceptor.LoginInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器配置
 *
 * @创建时间 2020/4/21 14:36
 */
@Slf4j
@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {
    @Autowired
    LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //JSOUP测试 登录

        registry.addInterceptor(loginInterceptor).addPathPatterns("/jsoup/**")//
                .addPathPatterns("/login/**")//拦截测试|放行登录
                .excludePathPatterns("/css/**", "/images/**", "/js/**", "/login.html", "/login/login");
    }
}
